/**
 * 便民服务api
 * @author: chenyq
 * @date: 2021-01-27
 */
import request from "@/utils/request";

// 分页查询列表操作
export function page(query) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/pageList",
    method: "get",
    params: query
  });
}

// 获取便民服务树信息
export function queryspecialerviceTree(parentOid) {
  if (parentOid == undefined) {
    parentOid = "";
  }
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/querySpecialServiceTree?parentOid=" +
      parentOid,
    method: "post"
  });
}

// 初始化便民服务信息
export function init(id, parentOid) {
  if (id == undefined) {
    id = "";
  }
  if (parentOid == undefined) {
    parentOid = "";
  }
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/getSpecialServiceById?id=" +
      id +
      "&parentOid=" +
      parentOid,
    method: "get"
  });
}

//删除便民服务信息
export function delspecialervice(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/deleteSpecialServiceById?id=" +
      id,
    method: "post"
  });
}

// 启禁用便民服务信息
export function ablespecialervice(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/ableSpecialServiceById?id=" +
      id,
    method: "post"
  });
}

/**
 *
 * @param {*} data
 * 保存便民服务数据
 */
export function saveOrUpdate(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/infoManage/specialService/saveOrUpdate",
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}
